package com.manage;

import java.util.ArrayList;
import java.util.List;

public class Student {
    private String name;
    private String id;
    private List<AttendanceRecord> attendanceRecords;
    private List<AnswerRecord> answerRecords;
    
    public Student(String id, String name) {
        this.id = id;
        this.name = name;
        this.attendanceRecords = new ArrayList<>();
        this.answerRecords = new ArrayList<>();
    }

    // 考勤记录
    public void addAttendanceRecord(AttendanceRecord record) {
        attendanceRecords.add(record);
    }

    // 答题记录
    public void addAnswerRecord(AnswerRecord record) {
        answerRecords.add(record);
    }

    // Getters and Setters
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<AttendanceRecord> getAttendanceRecords() {
        return attendanceRecords;
    }

    public List<AnswerRecord> getAnswerRecords() {
        return answerRecords;
    }

    /**
     * 重写toString方法，用于在JList中显示学生信息
     * @return 学号 - 姓名
     */
    @Override
    public String toString() {
        return id + " - " + name;
    }
}

